package com.wushijia.sort;

/**
 * 桶排序
 *
 * @author Administrator
 * @date 2021-06-15 11:21
 */
public class BucketSort {

  public static void main(String[] args) {

    int[] arr = {4, 1, 6, 9, 10, 22, 1, 7, 8, 100};

    int[] arr2 = new int[101];

    for (int i = 0; i < arr.length; i++) {
      arr2[arr[i]]++;
    }

    for (int i = 0; i < arr2.length; i++) {
      if (arr2[i] != 0) {
        for (int j = 0; j < arr2[i]; j++) {
          System.out.println(i);
        }
      }
    }
  }
}
